home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Interactive 11 / CDROM11.iso / pc / win95 / 1.cab / shared.dir / 00380_EVENT ROUTINES.ls < prev    next >
Encoding:
Text File  |  1995-06-02  |  6.2 KB  |  232 lines

  1. on stopMovie
  2.   dialogClose()
  3. end
  4.  
  5. on doControl delayTime
  6.   global gAutoMode, gTeaserMode, gResellerVersion, gAutoDelay, gAutoTestMode, gTopicList, gCurrTopic, gDialogWindow, gLastTextBox, gSectionAnimationSpeed, gCDROMversion, gLastAudio, gAudioPath
  7.   if objectp(gDialogWindow) then
  8.     go(the frame)
  9.     exit
  10.   end if
  11.   if gCDROMversion = 1 then
  12.     set audioFname to the name of cast the castNum of sprite 22
  13.     if audioFname <> gLastAudio then
  14.       set gLastAudio to audioFname
  15.       sound playFile 2, gAudioPath & audioFname
  16.     end if
  17.   end if
  18.   if gAutoMode = 1 then
  19.     if voidp(delayTime) then
  20.       if the type of sprite 22 = 7 then
  21.         set frameText to the text of cast the castNum of sprite 22
  22.         set delayTime to the number of chars in frameText * gAutoDelay
  23.         if gLastTextBox = frameText then
  24.           set delayTime to delayTime / 7
  25.         else
  26.           set gLastTextBox to frameText
  27.         end if
  28.       else
  29.         set delayTime to gSectionAnimationSpeed
  30.       end if
  31.     else
  32.       set delayTime to delayTime * 60
  33.     end if
  34.     if gAutoTestMode = 0 then
  35.       waitMouse(delayTime)
  36.     else
  37.       waitMouse()
  38.     end if
  39.     if the frameLabel <> "end" then
  40.       go(the frame + 1)
  41.     else
  42.       set gCurrTopic to gCurrTopic + 1
  43.       if (gCurrTopic < 1) or (gCurrTopic > the number of lines in gTopicList) then
  44.         set gAutoMode to 0
  45.         if gResellerVersion = 1 then
  46.           if gTeaserMode = 0 then
  47.             endAutoDemoDialogReseller()
  48.             exit
  49.           else
  50.             goCloser()
  51.           end if
  52.         else
  53.           endAutoDemoDialog()
  54.           exit
  55.         end if
  56.       else
  57.         set topic to line gCurrTopic of gTopicList
  58.         go(1, topic)
  59.       end if
  60.     end if
  61.   else
  62.     if the frame = marker(0) then
  63.       if the type of sprite 37 = 0 then
  64.         blinkForwardArrow()
  65.       else
  66.         showNextBtn()
  67.       end if
  68.     else
  69.       showNextBtn()
  70.     end if
  71.   end if
  72. end
  73.  
  74. on waitMouse t
  75.   if voidp(t) then
  76.     set t to 10
  77.   end if
  78.   startTimer()
  79.   repeat while the timer < t
  80.     if the mouseDown then
  81.       exit
  82.     end if
  83.   end repeat
  84. end
  85.  
  86. on wait t
  87.   if voidp(t) then
  88.     set t to 10
  89.   end if
  90.   startTimer()
  91.   repeat while the timer < t
  92.     nothing()
  93.   end repeat
  94. end
  95.  
  96. on keyDown
  97.   global gMainMovieName, gResellerVersion, gAutoMode, gNextKey, gBackKey, gMenuKey, gRestartKey, gExitKey
  98.   set k to the key
  99.   set kcode to the keyCode
  100.   if (the movie <> gMainMovieName) and (gAutoMode = 0) then
  101.     set channel to 0
  102.     if k = gNextKey then
  103.       set channel to 24
  104.     else
  105.       if k = gBackKey then
  106.         set channel to 23
  107.       else
  108.         if k = gMenuKey then
  109.           set channel to 25
  110.         else
  111.           if (k = gRestartKey) and (gResellerVersion = 1) then
  112.             set channel to 28
  113.           else
  114.             if (k = gExitKey) and (gResellerVersion = 0) then
  115.               set channel to 27
  116.             else
  117.               if kcode = 53 then
  118.                 exitDialog()
  119.                 dontPassEvent()
  120.               else
  121.                 if (k = TAB) or (k = RETURN) or (k = ENTER) then
  122.                   doControlPanelKeys()
  123.                   exit
  124.                 end if
  125.               end if
  126.             end if
  127.           end if
  128.         end if
  129.       end if
  130.     end if
  131.     if channel <> 0 then
  132.       hiliteButton(channel)
  133.       set gDontHilite to 0
  134.       mouseDown(script the scriptNum of sprite channel)
  135.     end if
  136.   end if
  137. end
  138.  
  139. on doControlPanelKeys
  140.   global gCurrCPButton, gCPbuttonIndex, gDontHilite, gAutoMode
  141.   if voidp(gCurrCPButton) or (gCurrCPButton = 0) then
  142.     set gCurrCPButton to 1
  143.   end if
  144.   set lastspritePos to gCurrCPButton
  145.   set startSprite to 1
  146.   set endSprite to 4
  147.   if gAutoMode = 1 then
  148.     exit
  149.   end if
  150.   if the key = TAB then
  151.     if not (the shiftDown) then
  152.       if lastspritePos < endSprite then
  153.         set gCurrCPButton to gCurrCPButton + 1
  154.       else
  155.         set gCurrCPButton to startSprite
  156.       end if
  157.     else
  158.       if lastspritePos = startSprite then
  159.         set gCurrCPButton to endSprite
  160.       else
  161.         set gCurrCPButton to gCurrCPButton - 1
  162.       end if
  163.     end if
  164.     set lastsprite to value(line lastspritePos of gCPbuttonIndex)
  165.     set c to the castNum of sprite lastsprite
  166.     set the castNum of sprite lastsprite to c - 1
  167.     set newSprite to value(line gCurrCPButton of gCPbuttonIndex)
  168.     set c to the castNum of sprite newSprite
  169.     set the castNum of sprite newSprite to c + 1
  170.     updateStage()
  171.   else
  172.     if (the key = RETURN) or (the key = ENTER) then
  173.       set lastsprite to value(line lastspritePos of gCPbuttonIndex)
  174.       hiliteButton(lastsprite)
  175.       resetNextButton()
  176.       set gDontHilite to 1
  177.       mouseDown(script the scriptNum of sprite lastsprite)
  178.     end if
  179.   end if
  180. end
  181.  
  182. on resetNextButton
  183.   global gCurrCPButton, gCPbuttonIndex
  184.   set lastspritePos to gCurrCPButton
  185.   set gCurrCPButton to 1
  186.   set lastsprite to value(line lastspritePos of gCPbuttonIndex)
  187.   set c to the castNum of sprite lastsprite
  188.   set the castNum of sprite lastsprite to c - 1
  189.   set newSprite to value(line gCurrCPButton of gCPbuttonIndex)
  190.   set c to the castNum of sprite newSprite
  191.   set the castNum of sprite newSprite to c + 1
  192. end
  193.  
  194. on doMenuKeys theKey, startSprite, endSprite
  195.   global gCurrDialogButton, gDontHilite, gResellerVersion
  196.   if voidp(gCurrDialogButton) or (gCurrDialogButton = 0) then
  197.     set gCurrDialogButton to 9
  198.   end if
  199.   set lastsprite to gCurrDialogButton
  200.   if the key = TAB then
  201.     if not (the shiftDown) then
  202.       if lastsprite < endSprite then
  203.         set gCurrDialogButton to gCurrDialogButton + 1
  204.       else
  205.         set gCurrDialogButton to startSprite
  206.       end if
  207.     else
  208.       if lastsprite = startSprite then
  209.         set gCurrDialogButton to endSprite
  210.       else
  211.         set gCurrDialogButton to gCurrDialogButton - 1
  212.       end if
  213.     end if
  214.     set c to the castNum of sprite lastsprite
  215.     set the castNum of sprite lastsprite to c - 1
  216.     set c to the castNum of sprite gCurrDialogButton
  217.     set the castNum of sprite gCurrDialogButton to c + 1
  218.     updateStage()
  219.   else
  220.     if (the key = RETURN) or (the key = ENTER) then
  221.       hiliteButton(lastsprite)
  222.       set gDontHilite to 1
  223.       mouseDown(script the scriptNum of sprite lastsprite)
  224.     else
  225.       if the keyCode = 53 then
  226.         exitDialog()
  227.         dontPassEvent()
  228.       end if
  229.     end if
  230.   end if
  231. end
  232.